<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../plugins/vue.min.js"></script>
    <style>
        .kerwin-enter-active{
            animation: aaa 1.5s;
        }
        .kerwin-leave-active{
            animation: aaa 1.5s reverse;
        }

        @keyframes aaa {
            0%{
                opacity: 0;
                transform: translateX(100px);
            }
            100%{
                opacity: 1;
                transform: translateX(0px);
            }
        }
    </style>
</head>
<body>
    <div id="box">
        
      <!-- <home v-show=" which === 'home' "></home>
     <list v-show=" which === 'list' "></list>
      <shopcar v-show=" which === 'shopcar' "></shopcar> -->

    
      <keep-alive>
        <!-- 先出 -->
        <transition name="kerwin" mode="out-in">
            <component :is="which"></component>
        </transition>
       
      </keep-alive>
        
      <footer>
        <ul>
            <li @click="which = 'home'">首页</li>
            <li @click="which = 'list'">列表</li>
            <li @click="which = 'shopcar'">购物车</li>
        </ul>
      </footer>


    </div>
    
    <script>
        Vue.component("home",{
            template:`
            <div>
                 home
                 <input type="search">
                 </div>
            `
        })
        Vue.component("list",{
            template:`
            <div>
               list5555
                 </div>
            `
        })
        Vue.component("shopcar",{
            template:`
            <div>
               shopcar
                 </div>
            `
        })
        let vm =  new Vue({
            el:"#box",
            data:{
                which:'home'
            }

        })
    </script>
</body>
</html>